<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class AddColumnStandardPlanTimeInTaskAndVersionTable extends AbstractMigration
{
    public function up()
    {
        $this->table("task")
            ->addColumn('standard_plan_time', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '计划交付时间 - 标准排期'])
            ->save();
        $this->table("version")
            ->addColumn('standard_plan_time', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '固化计划交付时间 - 标准排期'])
            ->save();
    }

    public function down()
    {
        if ($this->table("task")->hasColumn('standard_plan_time')) {
            $this->table("task")->removeColumn('standard_plan_time')->save();
        }
        if ($this->table("version")->hasColumn('standard_plan_time')) {
            $this->table("version")->removeColumn('standard_plan_time')->save();
        }
    }
}
